package demo3;
//
//import java.util.Scanner;
//
//public class Main {
//    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        while(scanner.hasNextInt()) {
//            int n = scanner.nextInt();
//            int i = 2;
//            System.out.print(n + "=");
//            while(n!=1) {
//                while(n%i==0) {
//                    System.out.print(i);
//                    n/=i;
//                    if(n!=1) System.out.print("*");
//                }
//                i++;
//            }
//            System.out.println();
//        }
//    }
//}

//2000 1 1 星期六

import java.io.*;

public class Main {
    static int[] months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    public static void main(String[] args) throws IOException {
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true) {
            String line = br.readLine();
            if(line == null) break;
            int year = Integer.parseInt(line);
            int tmp = getWeek(year);

            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
                months[2] = 29;
            } else {
                months[2] = 28;
            }

            //元旦
            pw.printf("%d-%02d-%02d\n", year, 1, 1);

            //1月的第三个星期一：马丁·路德·金纪念日
            int count = 0;
            int day = 0;
            int st = tmp;
            for(int i = 1 ;i<=31; i++) {
                if(st == 1) count++;
                if(count == 3) {
                    day = i;
                    break;
                }
                st ++;
                if(st == 7) st = 0;
            }
            pw.printf("%d-%02d-%02d\n", year, 1, day);

            //2月的第三个星期一：总统节
            st = (tmp + 31)%7;
            count = 0;
            for(int i = 1 ;i<=31; i++) {
                if(st == 1) count++;
                if(count == 3) {
                    day = i;
                    break;
                }
                st ++;
                if(st == 7) st = 0;
            }
            pw.printf("%d-%02d-%02d\n", year, 2, day);

            //5月的最后一个星期一：阵亡将士纪念日
            int gapDay = 0;
            for(int m = 1; m<5; m++) {
                gapDay += months[m];
            }
            st = (tmp + gapDay)%7;
            count = 0;
            for(int i = 1 ;i<=31; i++) {
                if(st == 1 && 31 - i < 7) {
                    day = i;
                    break;
                }
                st ++;
                if(st == 7) st = 0;
            }
            pw.printf("%d-%02d-%02d\n", year, 5, day);

            //7月4日：美国国庆
            pw.printf("%d-%02d-%02d\n", year, 7, 4);

            // 9月的第一个星期一：劳动节
            gapDay = 0;
            for(int m = 1; m<9; m++) {
                gapDay += months[m];
            }
            st = (tmp + gapDay)%7;
            for(int i = 1 ;i<=31; i++) {
                if(st == 1) {
                    day = i;
                    break;
                }
                st ++;
                if(st == 7) st = 0;
            }
            pw.printf("%d-%02d-%02d\n", year, 9, day);

            //11月的第四个星期四：感恩节
            gapDay = 0;
            for(int m = 1; m<11; m++) {
                gapDay += months[m];
            }
            st = (tmp + gapDay)%7;
            count = 0;
            for(int i = 1 ;i<=31; i++) {
                if(st == 4) count++;
                if(count == 4) {
                    day = i;
                    break;
                }
                st ++;
                if(st == 7) st = 0;
            }
            pw.printf("%d-%02d-%02d\n", year, 11, day);

            // 12月25日：圣诞节
            pw.printf("%d-%02d-%02d\n", year, 12, 25);
            pw.println();
            pw.flush();
        }
    }

    //获取每一年1月1日是星期几
    public static int getWeek(int year) {
        int st = 6;
        int gapDay = 0;
        for (int i = 2000; i < year; i++) {
            if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
                gapDay += 366;
            }else {
                gapDay += 365;
            }
        }
        st = (st + gapDay) % 7;
        return st;
    }
}